package com.ding.manager.controller.base;

import com.alibaba.fastjson.JSONObject;
import com.ding.manager.util.ResponseEntity;
import com.ding.manager.util.UrlConnectionUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import java.util.List;
import java.util.Map;

/**
 * <pre>
 * 对象功能:BaseUtil帮助类
 * 开发人员:lixin
 * 创建时间:2018-05-15
 * </pre>
 */
public class BaseUtil {

    protected Logger logger = Logger.getLogger(this.getClass());

    /**
     * 构建访问地址
     *
     * @param param
     * @param url
     * @return String
     */
    private String buildUrl(Map<String, String> param, String url) {
        StringBuffer sb = new StringBuffer(url);
        sb.append("?");
        int num = 0;
        for (Map.Entry<String, String> entry : param.entrySet()) {
            num++;
            sb.append(entry.getKey() + "=" + entry.getValue());
            if (num < param.size()) {
                sb.append("&");
            }
        }
        return sb.toString();
    }

}
